package cn.swust.util;

import java.util.Map;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthInterceptor extends AbstractInterceptor{
	
	public String intercept(ActionInvocation invocation)throws Exception
	{
		ActionContext ct = invocation.getInvocationContext();
		Map sesstion = ct.getSession();
		 String user = (String) sesstion.get("fullName");
		 System.out.println("user:"+user);
		 if(user!=null)
		 {
			 System.out.println(user);
				return invocation.invoke();
		 }
		 ct.put("tip", "你还为登录");		 
		return Action.LOGIN;
	}
}
